load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("source_control")

rust_library(
    name = "redirect-ffi",
    srcs = glob(["src/**/*.rs"]),
    cpp_deps = [":redirect-ffi-cpp-wrapper"],
    crate_root = "src/lib.rs",
    cxx_bridge = "src/lib.rs",
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:cxx",
        "fbsource//third-party/rust:tokio",
        "//eden/fs/cli_rs/edenfs-client:edenfs-client",
    ],
)

cpp_library(
    name = "redirect-ffi-cpp-wrapper",
    srcs = ["src/ffi.cpp"],
    headers = ["include/ffi.h"],
    preferred_linkage = "static",
    undefined_symbols = True,
    exported_deps = [
        ":redirect-ffi@header",
        "//eden/fs/service:thrift-cpp2-types",
    ],
)
